const express = require('express')

const app = express()

app.set('secret', 'ds5d1adfsdf212')

// 跨域
app.use(require('cors')())

// json 解决 post 请求 请求体的解析
app.use(express.json())

app.use('/uploads', express.static(__dirname + '/uploads'))
app.use('/admin', express.static(__dirname + '/admin'))
app.use('/', express.static(__dirname + '/web'))

require('./routes/plugins/db.js')(app)
require('./routes/admin')(app)
require('./routes/web')(app)

app.listen(3000, () => {
  console.log('running...')
})
